function ajaxPost( {url, data={}, success, error} ){
  let str = "";
  for(let i in data){
    str += `${i}=${data[i]}&`;
  }
  const xhr = new XMLHttpRequest;
  xhr.open("post", url, true);
  xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xhr.send(str.slice(0, -1));
  xhr.onload = function(){
    if(xhr.status === 200){
      success(xhr);
    }else{
      error(xhr.status);
    }
  }
}